import Vue from 'vue'
import Router from 'vue-router'
import login from '@/components/login'
import home from '@/components/home'
import addSale from '@/components/addSale'
import saleTable from '@/components/saleTable'
import axios from 'axios'
import VueAxios from 'vue-axios'
import showQuantity from "@/components/showQuantity";
//配置后端服务地址
axios.defaults.baseURL="http://localhost:8989/springboot_sales/"

Vue.use(VueAxios,axios)
Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect:"/login"
    },{
      path: '/login',
      name: 'login',
      component: login
    },{
      path: '/home',
      name: 'home',
      component: home,
      redirect: '/saleTable',
      children: [
        { path: '/saleTable', component: saleTable },
        { path: '/addSale', component: addSale },
        { path: '/showQuantity', component: showQuantity }
      ]
    }
  ]
})
